﻿@model System.Collections.IList
@{
    ViewBag.Title = "QueryBaklogTask";
    Layout = "~/Views/Shared/_BaseLayout.cshtml";
    var X = Html.X();
}
<h2>QueryBaklogTask</h2>
@section headtag
{
    <script>
        var popWindow = function (isAdd) {
            var loader = App.AddWindow.getLoader();
            loader.paramsFn.processState = '0';
            if (isAdd) {
                loader.paramsFn.processState = '2';
                loader.paramsFn.selectHolidayDocument = App.gpQueryBaklogTasks.getRowsValues({ selectedOnly: true });
            }
            App.AddWindow.show(this);
        };

        var showMsg = function () {
            Ext.Msg.notify("abc");
        }

        var linkDetail = function (value, cellmeta, record) {
            var temp = '<a href="#" onclick="clickName()" style="color:blue">{0}</a>';
            return Ext.String.format(temp, value);
        }

        var clickName = function () {
            document.getElementById("btnHolidayRequest").click();
        }
    </script>
}

@section example
{
    
    @(X.Viewport()
        .Layout(LayoutType.Border)
        .Items(
                X.Panel()
                  .Region(Region.Center)
                  .Margins("5 5 5 5")
                  .Items(
                        X.Button()
                            .ID("btnHolidayRequest")
                            .Text("请假申请")
                            .Handler("App.AddWindow.show(this);"),
                        X.Button()
                            .ID("btnProcessBaklogTasks")
                            .Text("处理待办")
                            .Handler("App.NextWindow.show(this);"),
                        X.Button()
                            .ID("btnHolidayRequestList")
                            .Text("查看请假申请")
                            .DirectClickAction("QueryHolidayDocument"),
                        X.GridPanel()
                            .ID("gpQueryBaklogTasks")
                            .Region(Region.Center)
                            .Title("待办列表")
                            .Store(X.Store()
                                    .Model(X.Model()
                                        .Fields(
                                                new ModelField("ProcessID", ModelFieldType.String),
                                                new ModelField("TaskName", ModelFieldType.String),
                                                new ModelField("RequestPerson", ModelFieldType.String),
                                                new ModelField("ProcessTime", ModelFieldType.Date),
                                                new ModelField("CurrentProcessNodeCode", ModelFieldType.String),
                                                new ModelField("NextProcessNodeCode", ModelFieldType.String)
                                                )
                                            )
                                    .DataSource(Model)
                                    )
                            .ColumnModel(
                                         X.Column().Text("TaskName").DataIndex("TaskName").Flex(1).Renderer("linkDetail"),
                                         X.Column().Text("RequestPerson").DataIndex("RequestPerson"),
                                         X.DateColumn().Text("ProcessTime").DataIndex("ProcessTime").Format("yyyy-MM-dd")
                                         
                                         )
                         )
               )
    )
    @(X.Window()
        .ID("AddWindow")
        .Title("请假单申请")
        .Width(700)
        .Height(500)
        .Modal(true)
        .AutoRender(false)
        .Collapsible(true)
        .Maximizable(true)
        .Hidden(true)
        .Loader(X.ComponentLoader()
                .Url("~/HolidayDocument/QueryHolidayDocument")
                .Mode(LoadMode.Frame)
                .LoadMask(lm => lm.ShowMask = true)
                .Params(new Parameter("selectHolidayDocument", ""))
                .Params(new Parameter("processState", "0"))
                )
    )
    @(X.Window()
        .ID("NextWindow")
        .Title("请假单申请")
        .Width(700)
        .Height(500)
        .Modal(true)
        .Collapsible(true)
        .Maximizable(true)
        .Hidden(true)
        .Loader(X.ComponentLoader()
                .Url("~/HolidayDocument/QueryHolidayDocument")
                .Mode(LoadMode.Frame)
                .ReloadOnEvent(true)
                .LoadMask(lm => lm.ShowMask = true)
                .Params(new Parameter("selectHolidayDocument", "App.gpQueryBaklogTasks.getRowsValues({ selectedOnly: true })[0].ProcessID", ParameterMode.Raw))
                .Params(new Parameter("processState", "2"))
                )
    )
}
